import type { VabRouteRecord } from '/#/router'
import Layout from '@vab/layouts/index.vue'

export const goodsRouter: VabRouteRecord = {
  path: '/goods',
  name: 'goods',
  component: Layout,
  meta: {
    title: '商品管理',
    icon: 'briefcase-2-fill',
    guard: {
      //2021年9月份新版本，当config/settings.js中rolesControl配置开启时，用于控制角色（全写）
      role: ['goodsArrtListView', 'goodsListView', 'goodsApproveEdit'],
      mode: 'oneOf', //allOf: 数组内所有角色都拥有，返回True oneOf: 数组内拥有任一角色，返回True(等价第1种数据) except: 不拥有数组内任一角色，返回True(取反)
    },
  },
  children: [
    {
      path: 'goodsList',
      name: 'goodsList',
      component: () => import('@/views/goods/goodsList.vue'),
      meta: {
        title: '商品信息',
        guard: {
          role: ['goodsListView'],
        },
      },
    },
    {
      path: 'goodsApprove',
      name: 'goodsApprove',
      component: () => import('@/views/goods/goodsApprove.vue'),
      meta: {
        title: '商品审核',
        hidden: true,
        tabHidden: true,
        guard: {
          role: ['goodsApproveEdit'],
        },
      },
    },
    {
      path: 'goodsArrtList',
      name: 'goodsArrtList',
      component: () => import('@/views/goods/goodsArrtList.vue'),
      meta: {
        title: '商品规格管理',
        guard: {
          role: ['goodsArrtListView'],
        },
      },
    },
  ],
}
